﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using WebComponents;
using WebComponents.Data;
using System.Collections.Generic;

public partial class QuangCao : System.Web.UI.UserControl {
  private string _position = "";
  private bool _showOne = false;

  public bool ShowOne {
    get { return _showOne; }
    set { _showOne = value; }
  }
  public string Position {
    get { return _position; }
    set { _position = value; }
  }
  protected void Page_Load(object sender, EventArgs e) {
    lblLeftBanner.Text = "";
    List<AdvertiseInfo> list = AdvertiseController.GetByPosition(Position);  
    foreach (AdvertiseInfo adv in list) {
      if (adv.Status == 1) {
        lblLeftBanner.Text = "<div>" + Common.LoadBannerMedia(Page, adv.MediaUrl, adv.Width, adv.Width, adv.Height, adv.Height, adv.NavigateUrl, adv.Target, adv.AlternateText) + "</div>\r\n" + lblLeftBanner.Text;
        if (ShowOne)
          break;
      }
    }
  }
}
